<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>新闻详情 - 甄成集团</title>
    <link rel="stylesheet" href="css/news.css">
    <link rel="stylesheet" href="css/index.css">
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
</head>
<style>
    .news-header {
        background-image: url('images/icons/bg_news.png');
    }
</style>
<body>
    <!-- 导航栏组件 -->
    <div id="navbar"></div>

    <!-- 新闻资讯头部 -->
    <section class="news-header header">
        <div class="header-content">
            <div class="page-info">
                <h2>新闻资讯</h2>
                <p>NEWS</p>
                <div class="breadcrumb">
                    <span>您的位置:</span>
                    <a href="index.php">首页</a>
                    <span>/</span>
                    <a href="news.php">新闻资讯</a>
                    <span>/</span>
                    <span>新闻详情</span>
                </div>
            </div>
        </div>
    </section>

    <!-- 新闻详情内容区 -->
    <section class="news-detail-section container" style="display:flex;align-items:flex-start;">
        <div class="news-detail-main" style="flex:3;">
            <div id="news-detail-content"></div>
            <!-- <div class="news-detail-pagination">
                <a href="#" class="prev"><img src="/images/icons/next@2x.png" alt="Previous"></a>
                <a href="#" class="active">1</a>
                <a href="#">2</a>
                <a href="#">3</a>
                <a href="#">4</a>
                <a href="#">5</a>
                <a href="#">6</a>
                <a href="#" class="next"><img src="/images/icons/next@2x.png" alt="Next"></a>
            </div> -->
        </div>
        <aside class="news-detail-aside" style="flex:1;min-width:320px;">
            <div class="aside-title">相关阅读</div>
            <div id="related-news"></div>
        </aside>
    </section>

    <!-- 页脚组件 -->
    <div id="footer"></div>

    <style>
  /* 新闻详情页专属样式 */
.news-detail-section {
    padding: 6.25rem 0;
    position: relative;
    max-width: 100rem;
    margin: 0 auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media screen and (max-width: 768px) {
    .news-detail-section {
        padding: 3rem 1rem;
        flex-direction: column;
    }
    
    .news-detail-main {
        flex: 1;
        width: 100%;
    }
    
    .news-detail-aside {
        flex: 1;
        width: 100%;
        min-width: auto;
        padding-left: 0;
        margin-top: 3rem;
        border-left: none;
        border-top: 1px solid #eee;
        padding-top: 2rem;
    }
    
    #news-detail-content h1 {
        font-size: 1.75rem;
        line-height: 2.25rem;
    }
    
    .news-meta {
        font-size: 0.875rem;
        margin-bottom: 1.5rem;
    }
    
    #news-detail-content .news-content {
        font-size: 0.9375rem;
        min-height: auto;
    }
    
    .related-news-card {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .related-news-card img {
        width: 100%;
        height: auto;
        margin-right: 0;
        margin-bottom: 1rem;
    }
    
    .related-title {
        font-size: 1rem;
        line-height: 1.5rem;
    }
    
    .related-desc {
        font-size: 0.875rem;
    }
}

@media screen and (min-width: 769px) and (max-width: 1024px) {
    .news-detail-section {
        padding: 4rem 2rem;
    }
    
    .news-detail-aside {
        padding-left: 2rem;
    }
    
    #news-detail-content h1 {
        font-size: 2rem;
        line-height: 2.75rem;
    }
}

.news-detail-main {
}
#news-detail-content h1 {
  font-weight: 700;
  font-size: 2.5rem;
  line-height: 3.25rem;
  text-align: left;
  color: #222132;
  margin-bottom: 1rem;
}
.news-meta {
  margin-bottom: 2.4375rem;
  font-weight: 400;
  font-size: 1.125rem;
  line-height: 1.5rem;
  text-align: left;
  color: #80899c;
}
#news-detail-content .news-content {
  margin: 0 auto;
  min-height: 48.875rem;
  font-family: "Microsoft YaHei";
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.5rem;
  text-align: left;
  color: #000;
}
.news-detail-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 3rem;
}
.news-detail-pagination a {
  min-width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 1.125rem;
  color: #b3c6e0;
  border-radius: 0.5rem;
  transition: background 0.2s, color 0.2s;
  background: transparent;
}
.news-detail-pagination a.active {
  color: #0e78ff;
  background: #e6f0ff;
  font-weight: 700;
}
.news-detail-pagination a.prev,
.news-detail-pagination a.next {
  background: #f4f6fa;
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.news-detail-pagination a.prev img {
  transform: rotate(180deg);
}

/* 侧栏 */
.news-detail-aside {
  width: 61.875rem;
  border-left: 0.0625rem solid #eee;
  padding-left: 5.75rem;
  box-sizing: border-box;
}
.aside-title {
  color: #152c5b;
  font-size: 1.25rem;
  font-face: Microsoft YaHei;
  font-weight: 700;
  line-height: 1.6875rem;
  letter-spacing: 0;
  margin-bottom: 2.1875rem;
}
#related-news {
  display: flex;
  flex-direction: column;
  gap: 3.875rem;
}
.related-news-card {
  display: flex;
  background: #fff;
  align-items: center;
  transition: box-shadow 0.2s;
}
.related-news-card img {
  width: 9.0625rem;
  height: 6.009375rem;
  object-fit: cover;
  margin-right: 1.75rem;
}
.related-title {
  color: #152c5b;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.75rem;
  margin-bottom: 0.8125rem;
}
.related-desc {
  font-weight: 400;
  font-size: 0.875rem;
  line-height: 1.5rem;
  color: #80899c;
}


    </style>

    <script src="js/loadComponents.js"></script>
    <script>
    // 新闻数据示例
    const newsData = {
        1: {
            title: "主品牌竞争战略",
            date: "2023-06-06 13:49:39",
            source: "许桦咨询官网",
            content: `<p>主品牌：是企业在其五大企业集团对外经营过程中担任全局、...（此处省略，实际可填充完整内容）</p>`
        },
        2: {
            title: "上市即超飞，今晚部今矿高级到上天了！",
            date: "2023-05-20 10:20:00",
            source: "今麦郎新闻",
            content: `<p>今矿上天了!自2月以来，业内就流传着今麦郎将推出高端矿泉水今矿的消息。但谁也没想到，今矿的首次亮相会如此惊艳...</p>`
        },
        3: {
            title: "品牌战略新趋势分析",
            date: "2023-04-15 09:00:00",
            source: "品牌研究院",
            content: `<p>随着市场环境的变化，品牌战略也在不断演进...</p>`
        },
        4: {
            title: "企业如何打造核心竞争力",
            date: "2023-03-10 14:30:00",
            source: "管理智库",
            content: `<p>核心竞争力是企业持续发展的关键...</p>`
        },
        5: {
            title: "数字化转型下的品牌创新",
            date: "2023-02-28 16:00:00",
            source: "数字经济网",
            content: `<p>数字化浪潮推动了品牌创新的步伐...</p>`
        },
        6: {
            title: "新消费时代的品牌升级",
            date: "2023-01-18 11:15:00",
            source: "消费日报",
            content: `<p>新消费时代，品牌升级成为企业发展的重要课题...</p>`
        }
    };
    // 相关阅读数据（可与主新闻不同）
    const relatedNews = [
        {id: 1, title: "链主品牌增长战略", desc: "战略定位咨询链主型企业战略方案，锻立新时期品牌链路定位...", img: "images/icons/bg_company.png"},
        {id: 2, title: "链主品牌增长战略", desc: "战略定位咨询链主型企业战略方案，锻立新时期品牌链路定位...", img: "images/icons/bg_company.png"},
        {id: 3, title: "链主品牌增长战略", desc: "战略定位咨询链主型企业战略方案，锻立新时期品牌链路定位...", img: "images/icons/bg_company.png"},
        {id: 4, title: "链主品牌增长战略", desc: "战略定位咨询链主型企业战略方案，锻立新时期品牌链路定位...", img: "images/icons/bg_company.png"}
    ];
    // 获取URL参数
    function getQueryVariable(variable) {
        const query = window.location.search.substring(1);
        const vars = query.split("&");
        for (let i = 0; i < vars.length; i++) {
            const pair = vars[i].split("=");
            if (pair[0] == variable) { return pair[1]; }
        }
        return false;
    }
    // 渲染新闻详情
    function renderNewsDetail() {
        const id = getQueryVariable("id");
        const news = newsData[id];
        const container = document.getElementById("news-detail-content");
        if (news) {
            container.innerHTML = `
                <h1>${news.title}</h1>
                <div class="news-meta">${news.date} &nbsp; 来源：${news.source}</div>
                <div class="news-content">${news.content}</div>
            `;
        } else {
            container.innerHTML = '<div style="color:red;">未找到该新闻内容</div>';
        }
    }
    // 渲染相关阅读
    function renderRelatedNews() {
        const container = document.getElementById("related-news");
        container.innerHTML = relatedNews.map(item => `
            <div class="related-news-card">
                <img src="${item.img}" alt="${item.title}"  onerror="this.onerror=null;this.src='images/placeholder.png';">
                <div>
                    <div class="related-title">${item.title}</div>
                    <div class="related-desc">${item.desc}</div>
                </div>
            </div>
        `).join("");
    }
    renderNewsDetail();
    renderRelatedNews();
    </script>
</body>
</html> 